import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    ws: null,
    user: null,
    isMainPage:false,
    operDescData:[],
    handleUserInfo:null,
    canHandle:false,
    yaokongstate:0,
    wsHandled:false,
  },
  getters: {},
  mutations: {
    setWsHandled(state,action){
      state.wsHandled=action
    },
    yaokongstate(state,action){
      state.yaokongstate=action
    },
    canHandle(state,canHandle){
      state.canHandle=canHandle
    },
    setWebSocket(state, webSocket) {
      state.ws = webSocket;
    },
    setUserInfo(state, userInfo) {
      state.user = userInfo;
    },
    setMainPage(state, isMainPage) {
      state.isMainPage = isMainPage;
    },
    operDescData(state,action){
      state.operDescData=action
    },
    handleUserInfo(state,action){
      state.handleUserInfo=action
    }
  },
  actions: {},
  modules: {},
  plugins: [createPersistedState({
    key: 'my-vuex-store',
  })]
});
